<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script>
    function diaryTypeDelete(diaryTypeId) {
        if(confirm("您确定要删除这条记录吗？")){
            window.location.href='diaryType?action=delete&diaryTypeId='+diaryTypeId;
        }
    }
</script>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="data_list">
    <div class="data_list_title">
        <img src="${pageContext.request.contextPath}/static/images/list_icon.png"/>日记类别列表
        <span class="diaryType_add">
            <button class="btn btn-mini btn-success" type="button" onclick="window.location.href='diaryType?action=preSave'">添加日志类别</button>
        </span>
    </div>
    <div class="diary_datas">
        <table class="table table-hover table-striped">
            <tr>
                <th>编号</th>
                <th>类别名称</th>
                <th>操作</th>
            </tr>
            <c:forEach var="diaryType" items="${diaryTypeList}">
                <tr>
                    <td>${diaryType.diaryTypeId}</td>
                    <td>${diaryType.typeName}</td>
                    <td>
                        <button class="btn btn-mini btn-info" type="button" onclick="window.location.href='diaryType?action=preSave&diaryTypeId=${diaryType.diaryTypeId}'">修改</button>&nbsp;
                        <button class="btn btn-mini btn-danger" type="button" onclick="diaryTypeDelete(${diaryType.diaryTypeId})">删除</button>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </div>
    <p align="center"><span style="color:red;font-size:x-large">${errorMsg}</span></p>
</div>

</body>
</html>
